<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item :label="$t('入库批次号')" prop="inBatchNo">
        <el-input v-model="queryParams.inBatchNo" :placeholder="$t('通用_请输入') + $t('入库批次号')" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">{{ $t('通用_搜索') }}</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{ $t('通用_重置') }}</el-button>
        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">{{ $t('通用_导出') }}</el-button>
      </el-form-item>
    </el-form>
    <el-table v-loading="loading" :data="dataList" border>
      <el-table-column :label="$t('日期')"  align="center" prop="dateTime" />
      <el-table-column :label="$t('工单号')" align="center" prop="productionOrder" />
      <el-table-column :label="$t('入库批次号')" align="center" prop="inBatchNo" />
      <el-table-column :label="$t('托号')"  align="center" prop="palletNo" />
      <el-table-column :label="$t('大标签')" align="center" prop="boxNo" />
      <el-table-column :label="$t('数量')" align="center" prop="qty" />
      <el-table-column :label="$t('单位')" align="center" prop="unit" />
      <el-table-column :label="$t('颜色')"  align="center" prop="color" />
      <el-table-column :label="$t('开压')"  align="center" prop="pressure" />
      <el-table-column :label="$t('效率')" align="center" prop="efficiency" />
      <el-table-column :label="$t('功率')" align="center" prop="power" />
      <el-table-column :label="$t('等级')"  align="center" prop="grade" />
      <el-table-column :label="$t('成品描述')" align="center" prop="productDesc" />
    </el-table>
    <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
  </div>
</template>

<script>
  import {
    listRuKu
  } from "@/api/system/aRuKu";

  export default {
    name: "ARuKu",
    data() {
      return {
        // 遮罩层
        loading: true,
        // 选中数组
        ids: [],
        // 非单个禁用
        single: true,
        // 非多个禁用
        multiple: true,
        // 显示搜索条件
        showSearch: true,
        // 总条数
        total: 0,
        // 发料配置表格数据
        dataList: [],
        // 弹出层标题
        title: "",
        // 是否显示弹出层
        open: false,
        // 查询参数
        queryParams: {
          pageNum: 1,
          pageSize: 10,
          inBatchNo: null
        },
      };
    },
    created() {
      this.getList();
    },
    methods: {
      /** 查询发料配置列表 */
      getList() {
        this.loading = true;
        listRuKu(this.queryParams).then(response => {
          this.dataList = response.rows;
          this.total = response.total;
          this.loading = false;
        });
      },
      // 取消按钮
      cancel() {
        this.open = false;
        this.reset();
      },
      // 表单重置
      reset() {
        this.form = {
          id: null,
          flbatch: null,
          dfloat: null,
          workorder: null,
          supplier: null,
          remaining: null,
          toal: null,
          groupId: null
        };
        this.resetForm("form");
      },
      /** 搜索按钮操作 */
      handleQuery() {
        this.queryParams.pageNum = 1;
        this.getList();
      },
      /** 重置按钮操作 */
      resetQuery() {
        this.resetForm("queryForm");
        this.handleQuery();
      },
      /** 导出按钮操作 */
      handleExport() {
        this.download('system/aResult/exportRuKu', {
          ...this.queryParams
        }, `aRuKu_${new Date().getTime()}.xlsx`)
      }
    }
  };
</script>
